package com.example.qt.ptplatform.controller;

import com.example.qt.ptplatform.service.AiAssistantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/assistant")
public class AiAssistantController {

    private final AiAssistantService aiAssistantService;

    @Autowired
    public AiAssistantController(AiAssistantService aiAssistantService) {
        this.aiAssistantService = aiAssistantService;
    }

    // 定义一个 POST 请求接口，接收用户消息并返回 AI 的回复
    @PostMapping("/chat")
    public String getAssistantResponse(@RequestBody String userMessage) {
        // 调用 service 层的逻辑处理用户消息
        return aiAssistantService.getAssistantResponse(userMessage);
    }
}

